package com.example.entity.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum EvaluationStatusEnum implements BaseEnum{
    UN_EVALUATED(0,"未评价"),
    EVALUATED(1,"已评价"),
    DEFAULT_GOOD(2,"已默认好评");

    @EnumValue
    private final int value;
    private final String desc;


    @JsonCreator(mode = JsonCreator.Mode.DELEGATING)
    public static EvaluationStatusEnum of(Integer value) {
        if (value == null) {
            return null;
        }
        for (EvaluationStatusEnum status : values()) {
            if (status.value == value) {
                return status;
            }
        }
        return null;
    }

    public static String desc(Integer value) {
        EvaluationStatusEnum status = of(value);
        return status == null ? "" : status.desc;
    }
}